{% extends "_layouts/mder.left_sidebar.twig" %}

{% block style %}
<link rel="stylesheet" type="text/css" href="/assets/src/mder/manager/index.css">
{% endblock %}
{% block bottomScript %}
    <script src="/assets/src/mder/manager/index.js"></script>
{% endblock %}

{% block sidebar %}
  {% include 'mder/manager/_sidebar.twig' %}
{% endblock %}

{% block body %}
<h1>Welcome to manager page</h1>
<hr>
  <!-- List group -->
  <div class="item-list">
    Config items list:
    {% for itemName in _globals.config.items %}
        <a href="{{ route }}?path=/{{ itemName }}">
          <span class="label label-{{ itemName == item ? 'primary' : 'default' }}">{{ itemName }}</span>
        </a>
    {% endfor %}
  </div>
<hr>


<ol class="breadcrumb" style="margin-bottom: 0;">
  <li><a href="{{ route }}"> <span class="glyphicon glyphicon-home"></span> Sources</a></li>
{% if path %}
{% set curPath = "" %}
{% for p in path|trim('/')|split('/') %}
  {# {% set curPath = curPath ~ '' ~ p  %} #}
  {% set curPath = "#{curPath}/#{p}"  %}
  {% if p == currentFolder %}
  <li class="active"><span class="glyphicon glyphicon-folder-open"></span> {{ p }}</li>
  {% else %}
  <li><a href="{{ route }}?path={{ curPath }}"> <span class="glyphicon glyphicon-folder-close"></span> {{ p }} </a></li>
  {% endif %}
{% endfor %}
{% endif %}
  <li class="pull-right"> Option:
    <label><input type="checkbox" name="show-all" value="{{ showAll }}" data-url="{{ route }}?path={{ path }}" {% if showAll %}checked="true"{% endif %}> 显示全部</label>
    <label><input type="checkbox" name="visit-newTab" checked="true"> 新标签访问</label>
  </li>
</ol>

<!-- directory-info -->
<div class="directory-info" id="J-sources-files">
  <ul class="list-group">
    {% for value in dataList %}
      <li class="list-group-item">
        {% if value['isFolder'] %}
          <span class="glyphicon glyphicon-folder-close"></span>
          <a href="{{ route }}?path={{ value.path }}" data-toggle="tooltip" data-placement="right" title="realpath: {{ value.realpath }}">/{{ value.name }}</a>
        {% else %}
          <span class="glyphicon glyphicon-file"></span>
          <a href="javascript:void(0);" data-toggle="tooltip" data-placement="right"
          title="size:{{ value.size }} | readable: {{ value.is_read }} | writable: {{ value.is_write }}">{{ value.name }}</a>
        {% endif %}

        <!-- operate -->
        <div class="operate pull-right">
          <div class="btn-group btn-group-xs" role="group" aria-label="...">
            <a role="button" href="{{ _globals.helper.getPageUrl(value.path, value.isFolder) }}" class="btn btn-success"><span class="glyphicon glyphicon-eye-open"></span></a>
            {# <button type="button" class="btn btn-danger"><span class="glyphicon glyphicon-remove"></span></button> #}
            <button type="button" class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span></button>

            <div class="btn-group btn-group-xs" role="group">
              <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                {# &hellip; #}
                <span class="caret"></span>
              </button>
              <ul class="dropdown-menu">
                <li><a href="#">Dropdown link</a></li>
                <li><a href="#">Dropdown link</a></li>
              </ul>
            </div>
          </div>
        </div>
        <!-- /.operate -->

      </li>
    {% endfor %}
  </ul>
</div>

{% endblock %}